// TabDlg.cpp : implementation file
//

#include "stdafx.h"
#include "CStudyChinese.h"
#include "TabDlg.h"
#include "FaceManager.h"
#include "FaceHandler.h"
#include "AppSetting.h"

#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif

/////////////////////////////////////////////////////////////////////////////
// CTabDlg dialog


CTabDlg::CTabDlg(UINT nIDTemplate,CWnd* pParent /*=NULL*/)
	: CDialog( nIDTemplate, pParent)
{
	//{{AFX_DATA_INIT(CTabDlg)
		// NOTE: the ClassWizard will add member initialization here
	//}}AFX_DATA_INIT
}


void CTabDlg::DoDataExchange(CDataExchange* pDX)
{
	CDialog::DoDataExchange(pDX);
	//{{AFX_DATA_MAP(CTabDlg)
		// NOTE: the ClassWizard will add DDX and DDV calls here
	//}}AFX_DATA_MAP
}


BEGIN_MESSAGE_MAP(CTabDlg, CDialog)
	//{{AFX_MSG_MAP(CTabDlg)
	ON_WM_CTLCOLOR()
	ON_WM_HELPINFO()
	//}}AFX_MSG_MAP
END_MESSAGE_MAP()

/////////////////////////////////////////////////////////////////////////////
// CTabDlg message handlers

void CTabDlg::SaveUpdateSetting()
{
	return ;
}

HBRUSH CTabDlg::OnCtlColor(CDC* pDC, CWnd* pWnd, UINT nCtlColor) 
{
	HBRUSH hbr; 
	switch(CAppSetting::Instance()->m_FaceMode)
	{
	case CAppSetting::FACE_NORMAL:
		pDC->SetBkColor(CFaceManager::Instance()->m_bkColor); // change the background color
		pDC->SetTextColor(CFaceManager::Instance()->m_TextColor); // change the text color
		hbr = (HBRUSH) CFaceManager::Instance()->m_brush; //  apply the brush
		break;
	case CAppSetting::FACE_NONRECTANGLE:
		pDC->SetBkColor(CFaceHandler::Instance()->m_bkColor); // change the background color
		pDC->SetTextColor(CFaceHandler::Instance()->m_TextColor); // change the text color
		hbr = (HBRUSH) CFaceHandler::Instance()->m_brush; //  apply the brush
		break;
	}	

	return hbr; // return brush
}

void CTabDlg::UpdateFace()
{
    return;
}

BOOL CTabDlg::PreTranslateMessage(MSG* pMsg) 
{
	if(pMsg->message ==WM_KEYDOWN)
	{
		if(pMsg->wParam == VK_ESCAPE||pMsg->wParam ==13)
			return FALSE;
	}
	return CDialog::PreTranslateMessage(pMsg);
}

BOOL CTabDlg::OnHelpInfo(HELPINFO* pHelpInfo) 
{
	CAppSetting::Instance()->ExecuteHelp();
	return TRUE;
	return CDialog::OnHelpInfo(pHelpInfo);
}
